3.13.20 \(\int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx\) [1220]

3.13.20.1 Optimal result
3.13.20.2 Mathematica [A] (verified)
3.13.20.3 Rubi [A] (verified)
3.13.20.4 Maple [A] (verified)
3.13.20.5 Fricas [B] (verification not implemented)
3.13.20.6 Sympy [F(-2)]
3.13.20.7 Maxima [B] (verification not implemented)
3.13.20.8 Giac [B] (verification not implemented)
3.13.20.9 Mupad [B] (verification not implemented)

3.13.20.1 Optimal result

Integrand size = 25, antiderivative size = 184 \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=-\frac {\left (2 b c d-a \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b^3 \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right ) (b c-a d)^2 f}+\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right )^2 f}+\frac {d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))} \]

output
-(2*b*c*d-a*(c^2-d^2))*x/(a^2+b^2)/(c^2+d^2)^2+b^3*ln(a*cos(f*x+e)+b*sin(f 
*x+e))/(a^2+b^2)/(-a*d+b*c)^2/f+d^2*(2*a*c*d-b*(3*c^2+d^2))*ln(c*cos(f*x+e 
)+d*sin(f*x+e))/(-a*d+b*c)^2/(c^2+d^2)^2/f+d^2/(-a*d+b*c)/(c^2+d^2)/f/(c+d 
*tan(f*x+e))
 
3.13.20.2 Mathematica [A] (verified)

Time = 2.38 (sec) , antiderivative size = 306, normalized size of antiderivative = 1.66 \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=\frac {\frac {(b c-a d)^2 \left (2 b \left (a-\sqrt {-b^2}\right ) c d+b^2 \left (c^2-d^2\right )+a \sqrt {-b^2} \left (c^2-d^2\right )\right ) \log \left (\sqrt {-b^2}-b \tan (e+f x)\right )-2 b^4 \left (c^2+d^2\right )^2 \log (a+b \tan (e+f x))+(b c-a d)^2 \left (2 b \left (a+\sqrt {-b^2}\right ) c d+b^2 \left (c^2-d^2\right )+a \sqrt {-b^2} \left (-c^2+d^2\right )\right ) \log \left (\sqrt {-b^2}+b \tan (e+f x)\right )+2 b \left (a^2+b^2\right ) d^2 \left (-2 a c d+b \left (3 c^2+d^2\right )\right ) \log (c+d \tan (e+f x))}{2 b \left (a^2+b^2\right ) (b c-a d) \left (c^2+d^2\right )}-\frac {d^2}{c+d \tan (e+f x)}}{(-b c+a d) \left (c^2+d^2\right ) f} \]

input
Integrate[1/((a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^2),x]
 
output
(((b*c - a*d)^2*(2*b*(a - Sqrt[-b^2])*c*d + b^2*(c^2 - d^2) + a*Sqrt[-b^2] 
*(c^2 - d^2))*Log[Sqrt[-b^2] - b*Tan[e + f*x]] - 2*b^4*(c^2 + d^2)^2*Log[a 
 + b*Tan[e + f*x]] + (b*c - a*d)^2*(2*b*(a + Sqrt[-b^2])*c*d + b^2*(c^2 - 
d^2) + a*Sqrt[-b^2]*(-c^2 + d^2))*Log[Sqrt[-b^2] + b*Tan[e + f*x]] + 2*b*( 
a^2 + b^2)*d^2*(-2*a*c*d + b*(3*c^2 + d^2))*Log[c + d*Tan[e + f*x]])/(2*b* 
(a^2 + b^2)*(b*c - a*d)*(c^2 + d^2)) - d^2/(c + d*Tan[e + f*x]))/((-(b*c) 
+ a*d)*(c^2 + d^2)*f)
 
3.13.20.3 Rubi [A] (verified)

Time = 0.95 (sec) , antiderivative size = 222, normalized size of antiderivative = 1.21, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.280, Rules used = {3042, 4052, 25, 3042, 4134, 3042, 4013}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2}dx\)

\(\Big \downarrow \) 4052

\(\displaystyle \frac {\int -\frac {-b d^2 \tan ^2(e+f x)+d (b c-a d) \tan (e+f x)+a c d-b \left (c^2+d^2\right )}{(a+b \tan (e+f x)) (c+d \tan (e+f x))}dx}{\left (c^2+d^2\right ) (b c-a d)}+\frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {\int \frac {-b d^2 \tan ^2(e+f x)+d (b c-a d) \tan (e+f x)+a c d-b \left (c^2+d^2\right )}{(a+b \tan (e+f x)) (c+d \tan (e+f x))}dx}{\left (c^2+d^2\right ) (b c-a d)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {\int \frac {-b d^2 \tan (e+f x)^2+d (b c-a d) \tan (e+f x)+a c d-b \left (c^2+d^2\right )}{(a+b \tan (e+f x)) (c+d \tan (e+f x))}dx}{\left (c^2+d^2\right ) (b c-a d)}\)

\(\Big \downarrow \) 4134

\(\displaystyle \frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {-\frac {b^3 \left (c^2+d^2\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)}dx}{\left (a^2+b^2\right ) (b c-a d)}-\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)}dx}{\left (c^2+d^2\right ) (b c-a d)}-\frac {x (b c-a d) \left (a c^2-a d^2-2 b c d\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )}}{\left (c^2+d^2\right ) (b c-a d)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {-\frac {b^3 \left (c^2+d^2\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)}dx}{\left (a^2+b^2\right ) (b c-a d)}-\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)}dx}{\left (c^2+d^2\right ) (b c-a d)}-\frac {x (b c-a d) \left (a c^2-a d^2-2 b c d\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )}}{\left (c^2+d^2\right ) (b c-a d)}\)

\(\Big \downarrow \) 4013

\(\displaystyle \frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {-\frac {x (b c-a d) \left (a c^2-a d^2-2 b c d\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )}-\frac {b^3 \left (c^2+d^2\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right ) (b c-a d)}-\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right ) (b c-a d)}}{\left (c^2+d^2\right ) (b c-a d)}\)

input
Int[1/((a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^2),x]
 
output
-((-(((b*c - a*d)*(a*c^2 - 2*b*c*d - a*d^2)*x)/((a^2 + b^2)*(c^2 + d^2))) 
- (b^3*(c^2 + d^2)*Log[a*Cos[e + f*x] + b*Sin[e + f*x]])/((a^2 + b^2)*(b*c 
 - a*d)*f) - (d^2*(2*a*c*d - b*(3*c^2 + d^2))*Log[c*Cos[e + f*x] + d*Sin[e 
 + f*x]])/((b*c - a*d)*(c^2 + d^2)*f))/((b*c - a*d)*(c^2 + d^2))) + d^2/(( 
b*c - a*d)*(c^2 + d^2)*f*(c + d*Tan[e + f*x]))
 

3.13.20.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4013
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* 
(x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si 
n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && 
 NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
 

rule 4052
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m + 1)*((c 
+ d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(a^2 + b^2)*(b*c - a*d))), x] + Simp[1 
/((m + 1)*(a^2 + b^2)*(b*c - a*d))   Int[(a + b*Tan[e + f*x])^(m + 1)*(c + 
d*Tan[e + f*x])^n*Simp[a*(b*c - a*d)*(m + 1) - b^2*d*(m + n + 2) - b*(b*c - 
 a*d)*(m + 1)*Tan[e + f*x] - b^2*d*(m + n + 2)*Tan[e + f*x]^2, x], x], x] / 
; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] 
 && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && LtQ[m, -1] && (LtQ[n, 0] || Integ 
erQ[m]) &&  !(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
 

rule 4134
Int[((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^ 
2)/(((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)])), x_Symbol] :> Simp[(a*(A*c - c*C + B*d) + b*(B*c - A*d + C*d))*(x/ 
((a^2 + b^2)*(c^2 + d^2))), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/((b*c - a*d) 
*(a^2 + b^2))   Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x] - Sim 
p[(c^2*C - B*c*d + A*d^2)/((b*c - a*d)*(c^2 + d^2))   Int[(d - c*Tan[e + f* 
x])/(c + d*Tan[e + f*x]), x], x]) /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] 
&& NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]
 
3.13.20.4 Maple [A] (verified)

Time = 0.63 (sec) , antiderivative size = 203, normalized size of antiderivative = 1.10

method result size
derivativedivides \(\frac {\frac {\frac {\left (-2 a c d -b \,c^{2}+b \,d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a \,c^{2}-a \,d^{2}-2 b c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}-\frac {d^{2}}{\left (a d -b c \right ) \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {d^{2} \left (2 a c d -3 b \,c^{2}-b \,d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (c^{2}+d^{2}\right )^{2}}+\frac {b^{3} \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right ) \left (a d -b c \right )^{2}}}{f}\) \(203\)
default \(\frac {\frac {\frac {\left (-2 a c d -b \,c^{2}+b \,d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a \,c^{2}-a \,d^{2}-2 b c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}-\frac {d^{2}}{\left (a d -b c \right ) \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {d^{2} \left (2 a c d -3 b \,c^{2}-b \,d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (c^{2}+d^{2}\right )^{2}}+\frac {b^{3} \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right ) \left (a d -b c \right )^{2}}}{f}\) \(203\)
norman \(\frac {-\frac {d^{2}}{f \left (a \,c^{2} d +a \,d^{3}-b \,c^{3}-b c \,d^{2}\right )}+\frac {\left (a \,c^{2}-a \,d^{2}-2 b c d \right ) c x}{\left (a^{2}+b^{2}\right ) \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {d \left (a \,c^{2}-a \,d^{2}-2 b c d \right ) x \tan \left (f x +e \right )}{\left (a^{2}+b^{2}\right ) \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}}{c +d \tan \left (f x +e \right )}+\frac {b^{3} \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) f \left (a^{2}+b^{2}\right )}+\frac {d^{2} \left (2 a c d -3 b \,c^{2}-b \,d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (a^{2} c^{4} d^{2}+2 a^{2} c^{2} d^{4}+a^{2} d^{6}-2 a b \,c^{5} d -4 a b \,c^{3} d^{3}-2 a b c \,d^{5}+b^{2} c^{6}+2 b^{2} c^{4} d^{2}+b^{2} c^{2} d^{4}\right )}-\frac {\left (2 a c d +b \,c^{2}-b \,d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (a^{2}+b^{2}\right ) \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}\) \(379\)
parallelrisch \(\text {Expression too large to display}\) \(1175\)
risch \(\text {Expression too large to display}\) \(1273\)

input
int(1/(a+b*tan(f*x+e))/(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
 
output
1/f*(1/(a^2+b^2)/(c^2+d^2)^2*(1/2*(-2*a*c*d-b*c^2+b*d^2)*ln(1+tan(f*x+e)^2 
)+(a*c^2-a*d^2-2*b*c*d)*arctan(tan(f*x+e)))-d^2/(a*d-b*c)/(c^2+d^2)/(c+d*t 
an(f*x+e))+d^2*(2*a*c*d-3*b*c^2-b*d^2)/(a*d-b*c)^2/(c^2+d^2)^2*ln(c+d*tan( 
f*x+e))+b^3/(a^2+b^2)/(a*d-b*c)^2*ln(a+b*tan(f*x+e)))
 
3.13.20.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 711 vs. \(2 (184) = 368\).

Time = 0.51 (sec) , antiderivative size = 711, normalized size of antiderivative = 3.86 \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=\frac {2 \, {\left (a^{2} b + b^{3}\right )} c d^{4} - 2 \, {\left (a^{3} + a b^{2}\right )} d^{5} + 2 \, {\left (a b^{2} c^{5} - a^{3} c d^{4} - 2 \, {\left (a^{2} b + b^{3}\right )} c^{4} d + {\left (a^{3} + 3 \, a b^{2}\right )} c^{3} d^{2}\right )} f x + {\left (b^{3} c^{5} + 2 \, b^{3} c^{3} d^{2} + b^{3} c d^{4} + {\left (b^{3} c^{4} d + 2 \, b^{3} c^{2} d^{3} + b^{3} d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (3 \, {\left (a^{2} b + b^{3}\right )} c^{3} d^{2} - 2 \, {\left (a^{3} + a b^{2}\right )} c^{2} d^{3} + {\left (a^{2} b + b^{3}\right )} c d^{4} + {\left (3 \, {\left (a^{2} b + b^{3}\right )} c^{2} d^{3} - 2 \, {\left (a^{3} + a b^{2}\right )} c d^{4} + {\left (a^{2} b + b^{3}\right )} d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left ({\left (a^{2} b + b^{3}\right )} c^{2} d^{3} - {\left (a^{3} + a b^{2}\right )} c d^{4} - {\left (a b^{2} c^{4} d - a^{3} d^{5} - 2 \, {\left (a^{2} b + b^{3}\right )} c^{3} d^{2} + {\left (a^{3} + 3 \, a b^{2}\right )} c^{2} d^{3}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left ({\left (a^{2} b^{2} + b^{4}\right )} c^{6} d - 2 \, {\left (a^{3} b + a b^{3}\right )} c^{5} d^{2} + {\left (a^{4} + 3 \, a^{2} b^{2} + 2 \, b^{4}\right )} c^{4} d^{3} - 4 \, {\left (a^{3} b + a b^{3}\right )} c^{3} d^{4} + {\left (2 \, a^{4} + 3 \, a^{2} b^{2} + b^{4}\right )} c^{2} d^{5} - 2 \, {\left (a^{3} b + a b^{3}\right )} c d^{6} + {\left (a^{4} + a^{2} b^{2}\right )} d^{7}\right )} f \tan \left (f x + e\right ) + {\left ({\left (a^{2} b^{2} + b^{4}\right )} c^{7} - 2 \, {\left (a^{3} b + a b^{3}\right )} c^{6} d + {\left (a^{4} + 3 \, a^{2} b^{2} + 2 \, b^{4}\right )} c^{5} d^{2} - 4 \, {\left (a^{3} b + a b^{3}\right )} c^{4} d^{3} + {\left (2 \, a^{4} + 3 \, a^{2} b^{2} + b^{4}\right )} c^{3} d^{4} - 2 \, {\left (a^{3} b + a b^{3}\right )} c^{2} d^{5} + {\left (a^{4} + a^{2} b^{2}\right )} c d^{6}\right )} f\right )}} \]

input
integrate(1/(a+b*tan(f*x+e))/(c+d*tan(f*x+e))^2,x, algorithm="fricas")
 
output
1/2*(2*(a^2*b + b^3)*c*d^4 - 2*(a^3 + a*b^2)*d^5 + 2*(a*b^2*c^5 - a^3*c*d^ 
4 - 2*(a^2*b + b^3)*c^4*d + (a^3 + 3*a*b^2)*c^3*d^2)*f*x + (b^3*c^5 + 2*b^ 
3*c^3*d^2 + b^3*c*d^4 + (b^3*c^4*d + 2*b^3*c^2*d^3 + b^3*d^5)*tan(f*x + e) 
)*log((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e) + a^2)/(tan(f*x + e)^2 + 1) 
) - (3*(a^2*b + b^3)*c^3*d^2 - 2*(a^3 + a*b^2)*c^2*d^3 + (a^2*b + b^3)*c*d 
^4 + (3*(a^2*b + b^3)*c^2*d^3 - 2*(a^3 + a*b^2)*c*d^4 + (a^2*b + b^3)*d^5) 
*tan(f*x + e))*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f* 
x + e)^2 + 1)) - 2*((a^2*b + b^3)*c^2*d^3 - (a^3 + a*b^2)*c*d^4 - (a*b^2*c 
^4*d - a^3*d^5 - 2*(a^2*b + b^3)*c^3*d^2 + (a^3 + 3*a*b^2)*c^2*d^3)*f*x)*t 
an(f*x + e))/(((a^2*b^2 + b^4)*c^6*d - 2*(a^3*b + a*b^3)*c^5*d^2 + (a^4 + 
3*a^2*b^2 + 2*b^4)*c^4*d^3 - 4*(a^3*b + a*b^3)*c^3*d^4 + (2*a^4 + 3*a^2*b^ 
2 + b^4)*c^2*d^5 - 2*(a^3*b + a*b^3)*c*d^6 + (a^4 + a^2*b^2)*d^7)*f*tan(f* 
x + e) + ((a^2*b^2 + b^4)*c^7 - 2*(a^3*b + a*b^3)*c^6*d + (a^4 + 3*a^2*b^2 
 + 2*b^4)*c^5*d^2 - 4*(a^3*b + a*b^3)*c^4*d^3 + (2*a^4 + 3*a^2*b^2 + b^4)* 
c^3*d^4 - 2*(a^3*b + a*b^3)*c^2*d^5 + (a^4 + a^2*b^2)*c*d^6)*f)
 
3.13.20.6 Sympy [F(-2)]

Exception generated. \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=\text {Exception raised: NotImplementedError} \]

input
integrate(1/(a+b*tan(f*x+e))/(c+d*tan(f*x+e))**2,x)
 
output
Exception raised: NotImplementedError >> no valid subset found
 
3.13.20.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 384 vs. \(2 (184) = 368\).

Time = 0.32 (sec) , antiderivative size = 384, normalized size of antiderivative = 2.09 \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=\frac {\frac {2 \, b^{3} \log \left (b \tan \left (f x + e\right ) + a\right )}{{\left (a^{2} b^{2} + b^{4}\right )} c^{2} - 2 \, {\left (a^{3} b + a b^{3}\right )} c d + {\left (a^{4} + a^{2} b^{2}\right )} d^{2}} + \frac {2 \, {\left (a c^{2} - 2 \, b c d - a d^{2}\right )} {\left (f x + e\right )}}{{\left (a^{2} + b^{2}\right )} c^{4} + 2 \, {\left (a^{2} + b^{2}\right )} c^{2} d^{2} + {\left (a^{2} + b^{2}\right )} d^{4}} + \frac {2 \, d^{2}}{b c^{4} - a c^{3} d + b c^{2} d^{2} - a c d^{3} + {\left (b c^{3} d - a c^{2} d^{2} + b c d^{3} - a d^{4}\right )} \tan \left (f x + e\right )} - \frac {2 \, {\left (3 \, b c^{2} d^{2} - 2 \, a c d^{3} + b d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{b^{2} c^{6} - 2 \, a b c^{5} d - 4 \, a b c^{3} d^{3} - 2 \, a b c d^{5} + a^{2} d^{6} + {\left (a^{2} + 2 \, b^{2}\right )} c^{4} d^{2} + {\left (2 \, a^{2} + b^{2}\right )} c^{2} d^{4}} - \frac {{\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{{\left (a^{2} + b^{2}\right )} c^{4} + 2 \, {\left (a^{2} + b^{2}\right )} c^{2} d^{2} + {\left (a^{2} + b^{2}\right )} d^{4}}}{2 \, f} \]

input
integrate(1/(a+b*tan(f*x+e))/(c+d*tan(f*x+e))^2,x, algorithm="maxima")
 
output
1/2*(2*b^3*log(b*tan(f*x + e) + a)/((a^2*b^2 + b^4)*c^2 - 2*(a^3*b + a*b^3 
)*c*d + (a^4 + a^2*b^2)*d^2) + 2*(a*c^2 - 2*b*c*d - a*d^2)*(f*x + e)/((a^2 
 + b^2)*c^4 + 2*(a^2 + b^2)*c^2*d^2 + (a^2 + b^2)*d^4) + 2*d^2/(b*c^4 - a* 
c^3*d + b*c^2*d^2 - a*c*d^3 + (b*c^3*d - a*c^2*d^2 + b*c*d^3 - a*d^4)*tan( 
f*x + e)) - 2*(3*b*c^2*d^2 - 2*a*c*d^3 + b*d^4)*log(d*tan(f*x + e) + c)/(b 
^2*c^6 - 2*a*b*c^5*d - 4*a*b*c^3*d^3 - 2*a*b*c*d^5 + a^2*d^6 + (a^2 + 2*b^ 
2)*c^4*d^2 + (2*a^2 + b^2)*c^2*d^4) - (b*c^2 + 2*a*c*d - b*d^2)*log(tan(f* 
x + e)^2 + 1)/((a^2 + b^2)*c^4 + 2*(a^2 + b^2)*c^2*d^2 + (a^2 + b^2)*d^4)) 
/f
 
3.13.20.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 533 vs. \(2 (184) = 368\).

Time = 0.45 (sec) , antiderivative size = 533, normalized size of antiderivative = 2.90 \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=\frac {\frac {2 \, b^{4} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{2} b^{3} c^{2} + b^{5} c^{2} - 2 \, a^{3} b^{2} c d - 2 \, a b^{4} c d + a^{4} b d^{2} + a^{2} b^{3} d^{2}} + \frac {2 \, {\left (a c^{2} - 2 \, b c d - a d^{2}\right )} {\left (f x + e\right )}}{a^{2} c^{4} + b^{2} c^{4} + 2 \, a^{2} c^{2} d^{2} + 2 \, b^{2} c^{2} d^{2} + a^{2} d^{4} + b^{2} d^{4}} - \frac {{\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{2} c^{4} + b^{2} c^{4} + 2 \, a^{2} c^{2} d^{2} + 2 \, b^{2} c^{2} d^{2} + a^{2} d^{4} + b^{2} d^{4}} - \frac {2 \, {\left (3 \, b c^{2} d^{3} - 2 \, a c d^{4} + b d^{5}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{b^{2} c^{6} d - 2 \, a b c^{5} d^{2} + a^{2} c^{4} d^{3} + 2 \, b^{2} c^{4} d^{3} - 4 \, a b c^{3} d^{4} + 2 \, a^{2} c^{2} d^{5} + b^{2} c^{2} d^{5} - 2 \, a b c d^{6} + a^{2} d^{7}} + \frac {2 \, {\left (3 \, b c^{2} d^{3} \tan \left (f x + e\right ) - 2 \, a c d^{4} \tan \left (f x + e\right ) + b d^{5} \tan \left (f x + e\right ) + 4 \, b c^{3} d^{2} - 3 \, a c^{2} d^{3} + 2 \, b c d^{4} - a d^{5}\right )}}{{\left (b^{2} c^{6} - 2 \, a b c^{5} d + a^{2} c^{4} d^{2} + 2 \, b^{2} c^{4} d^{2} - 4 \, a b c^{3} d^{3} + 2 \, a^{2} c^{2} d^{4} + b^{2} c^{2} d^{4} - 2 \, a b c d^{5} + a^{2} d^{6}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}}}{2 \, f} \]

input
integrate(1/(a+b*tan(f*x+e))/(c+d*tan(f*x+e))^2,x, algorithm="giac")
 
output
1/2*(2*b^4*log(abs(b*tan(f*x + e) + a))/(a^2*b^3*c^2 + b^5*c^2 - 2*a^3*b^2 
*c*d - 2*a*b^4*c*d + a^4*b*d^2 + a^2*b^3*d^2) + 2*(a*c^2 - 2*b*c*d - a*d^2 
)*(f*x + e)/(a^2*c^4 + b^2*c^4 + 2*a^2*c^2*d^2 + 2*b^2*c^2*d^2 + a^2*d^4 + 
 b^2*d^4) - (b*c^2 + 2*a*c*d - b*d^2)*log(tan(f*x + e)^2 + 1)/(a^2*c^4 + b 
^2*c^4 + 2*a^2*c^2*d^2 + 2*b^2*c^2*d^2 + a^2*d^4 + b^2*d^4) - 2*(3*b*c^2*d 
^3 - 2*a*c*d^4 + b*d^5)*log(abs(d*tan(f*x + e) + c))/(b^2*c^6*d - 2*a*b*c^ 
5*d^2 + a^2*c^4*d^3 + 2*b^2*c^4*d^3 - 4*a*b*c^3*d^4 + 2*a^2*c^2*d^5 + b^2* 
c^2*d^5 - 2*a*b*c*d^6 + a^2*d^7) + 2*(3*b*c^2*d^3*tan(f*x + e) - 2*a*c*d^4 
*tan(f*x + e) + b*d^5*tan(f*x + e) + 4*b*c^3*d^2 - 3*a*c^2*d^3 + 2*b*c*d^4 
 - a*d^5)/((b^2*c^6 - 2*a*b*c^5*d + a^2*c^4*d^2 + 2*b^2*c^4*d^2 - 4*a*b*c^ 
3*d^3 + 2*a^2*c^2*d^4 + b^2*c^2*d^4 - 2*a*b*c*d^5 + a^2*d^6)*(d*tan(f*x + 
e) + c)))/f
 
3.13.20.9 Mupad [B] (verification not implemented)

Time = 9.34 (sec) , antiderivative size = 374, normalized size of antiderivative = 2.03 \[ \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx=\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\frac {b\,c^2+2\,a\,c\,d-b\,d^2}{\left (a^2+b^2\right )\,{\left (c^2+d^2\right )}^2}+\frac {b\,d^2}{{\left (a\,d-b\,c\right )}^2\,\left (c^2+d^2\right )}-\frac {2\,c\,d^2}{\left (a\,d-b\,c\right )\,{\left (c^2+d^2\right )}^2}\right )}{f}-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (b\,\left (3\,c^2\,d^2+d^4\right )-2\,a\,c\,d^3\right )}{f\,\left (a^2\,c^4\,d^2+2\,a^2\,c^2\,d^4+a^2\,d^6-2\,a\,b\,c^5\,d-4\,a\,b\,c^3\,d^3-2\,a\,b\,c\,d^5+b^2\,c^6+2\,b^2\,c^4\,d^2+b^2\,c^2\,d^4\right )}-\frac {d^2}{f\,\left (a\,d-b\,c\right )\,\left (c^2+d^2\right )\,\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (a\,c^2-a\,d^2-2\,b\,c\,d+b\,c^2\,1{}\mathrm {i}-b\,d^2\,1{}\mathrm {i}+a\,c\,d\,2{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (a\,d^2-a\,c^2+2\,b\,c\,d+b\,c^2\,1{}\mathrm {i}-b\,d^2\,1{}\mathrm {i}+a\,c\,d\,2{}\mathrm {i}\right )} \]

input
int(1/((a + b*tan(e + f*x))*(c + d*tan(e + f*x))^2),x)
 
output
(log(a + b*tan(e + f*x))*((b*c^2 - b*d^2 + 2*a*c*d)/((a^2 + b^2)*(c^2 + d^ 
2)^2) + (b*d^2)/((a*d - b*c)^2*(c^2 + d^2)) - (2*c*d^2)/((a*d - b*c)*(c^2 
+ d^2)^2)))/f - (log(tan(e + f*x) + 1i)*1i)/(2*f*(a*d^2 - a*c^2 + b*c^2*1i 
 - b*d^2*1i + a*c*d*2i + 2*b*c*d)) - (log(tan(e + f*x) - 1i)*1i)/(2*f*(a*c 
^2 - a*d^2 + b*c^2*1i - b*d^2*1i + a*c*d*2i - 2*b*c*d)) - (log(c + d*tan(e 
 + f*x))*(b*(d^4 + 3*c^2*d^2) - 2*a*c*d^3))/(f*(a^2*d^6 + b^2*c^6 + 2*a^2* 
c^2*d^4 + a^2*c^4*d^2 + b^2*c^2*d^4 + 2*b^2*c^4*d^2 - 2*a*b*c*d^5 - 2*a*b* 
c^5*d - 4*a*b*c^3*d^3)) - d^2/(f*(a*d - b*c)*(c^2 + d^2)*(c + d*tan(e + f* 
x)))